<?php
  function notification_form_validation($form) {
  
	//print_r($form); die;
    $stat = new set_static_variable();
	
	//print "form type : " .  $form['type']['#value'];
	
	//Concerned dept validation
	 //chk_concerned_dept($form['field_not_department']);  
	  
    //tittle validation
    //check_title_duplication($form['title'], $form['type']['#value'], 
	
    //$form['field_not_department'], 'field_not_department', $stat->get_nid());
    $stat->set_nid(0);
    
    //echo "aa".$form['field_not_keyword']['und'][0]['value'] ['#value'];
	
    chkbadchar($form['field_not_description'][0]['value']['#value'],$form['field_not_description']['#title'],'field_not_description');
    chkbadchar($form['title']['#value'], $form['title']['#title'], 'title');
    chkbadchar($form['field_not_keyword']['und'][0]['value'] ['#value'],$form['field_not_keyword']['und'][0]['value']['#title'],'field_not_keyword');
	chkbadchar($form['field_not_short_title'][0]['value']['#value'],$form['field_not_short_title']['#title'],'field_not_short_title');
   	
	// district validation 
	distvalidation($form['field_not_district']['und']['#value']); 
	
	// Date Validation  

    //check_scheduler_date_expire($form['scheduler_settings']['unpublish_on']['date']['#value'],'unpublish_on');
	
	Commencement_date($form['field_not_date']['und'][0]['value']['date']['#value'],$form['field_not_date']['und'][0]['#title'],'field_not_date');												
	//check_date_expire($form['field_not_date'][0]['value']['date']['#value'],$form['field_not_date']['#title']);
	
	// maximum length validation for Title and Description Field
  	maxlength_validation($form['title']['#value'], 255, $form['title']['#title'], 'title');
	
	// minimum length charcter   
  	minilength_validation($form['title']['#value'], 5, $form['title']['#title'], 'title');
  	minilength_validation($form['field_not_keyword']['und'][0]['value'] ['#value'], 5, $form['field_not_keyword']['und'][0]['value']['#title'],'field_not_keyword');
	minilength_validation($form['field_not_description'][0]['value']['#value'], 5, $form['field_not_description']['#title'],'field_not_description');
   
    // Circulars Number 
	check_integer($form['field_not_number']['und'][0]['value']['#value'],$form['field_not_number']['und'][0]['value']['#title'],'field_not_number');
	check_integer($form['field_act_year'][0]['value']['#value'], $form['field_act_year']['#title'], $form['field_act_year'][0]['#field_name']);
	
	// Circulars Year 
	check_integer($form['field_not_year'][0]['value']['#value'],$form['field_not_year']['#title'],'field_not_year');
	years($form['field_not_year'][0]['value']['#value'],$form['field_not_year']['#title'],'field_not_year');
	
	
	url_validation($form['field_not_url']['und'][0]['value']['#value']);
	
	
    if ($form['field_not_availabilty']['und']['#value'] == 'download') { 
    // Validating the file size   
    //$field_obj = $form['field_act_file_upload']; 
	//$file_allowed_obj = $form_type;
	//print_r($form['field_act_file_upload']);
	$filename = $form['field_act_file_upload']['und'][0]['#file']; 
	$filename->filename;
    file_upload_validation_D7($filename->filename,$form['field_not_availabilty']['und']['#title']);  
  
  }
   
    
/*    check_date_expire($form['field_not_date']);
*/    
    
    /* Validation for notification number*/
    
    //$number = $form['field_not_notification'][0]['value']['#value'];
  //  check_integer($number, $form['field_not_notification']['#title'], 'field_not_notification'); 
 
  }
  function notification_presave_validation($node) {
    $reference_url = $node->field_docurl[0]['value'];
    $node->field_docurl[0]['value'] = url_validation($reference_url);
  }
  

  
 
